home *** CD-ROM | disk | FTP | other *** search
/ Megahits 6 / Megahits 6 (1995)(GTI - Rhein-Main-Soft)(DE)(Disc 2 of 2)[!].iso / time_ungepackt / time_361_390 / time_375 / m&m3.13 / install.rexx < prev    next >
OS/2 REXX Batch file  |  1995-07-15  |  8KB  |  345 lines

  1. /* Menus & More Installation Script for use with ARexx      */
  2. /*                                                          */
  3. /* $VER: Install.rexx 3.00 (11.02.95) by Axel Sodtalbers    */
  4. /*                                                          */
  5. /* oh dear, what a strange language...                      */
  6.  
  7.  
  8. /*** Init ***/
  9. OPTIONS RESULTS
  10. OPTIONS FAILAT 21
  11. ADDRESS "MMPlayer"
  12.  
  13. 'AlohaPlayer'
  14. 'Query ISGERMAN'
  15. ger = RESULT
  16. oldstatus = ''
  17.  
  18. 'SwitchButton 0 0'
  19.  
  20. /*** fetch target directory ***/
  21. if ger then do
  22.     "Req 'Gleich erscheint ein Verzeichnis-Requester.||||Bitte geben Sie dort an, in welches||||Verzeichnis Menus&More angelegt werden soll!||' 'Okay, klar zum Abheben!'"
  23.     "ReqDir 'M&M installieren nach:' 'RAM:'"
  24.     if RESULT>0 then
  25.       target=RESULT
  26.     else
  27.       exit   
  28. end
  29. else do
  30.    "Req 'After this, a directory-requester will appear.|||| Please select, in which drawer M&M shall be copied to!' 'Okay, ready for take off!'"
  31.    "ReqDir 'Install M&M to:' 'RAM:'"
  32.    if RESULT>0 then
  33.       target=RESULT
  34.    else
  35.       exit
  36. end
  37.  
  38. 'FileExists' target
  39. if result=0 then do
  40.    if ger then
  41.       "Req" "'Das angebene Verzeichnis||||" || target || "||||existiert nicht!||'" "'Verzeichnis erstellen|Abbrechen'"
  42.    else
  43.       "Req" "'The given drawer||||" || target || "||||does not exist!||'" "'Create the drawer|Cancel'"
  44.  
  45.    if RESULT=1 then do
  46.       ADDRESS COMMAND MakeDir "> nil:" target
  47.       ADDRESS COMMAND "Copy Examples.info to "||target||".info QUIET" 
  48.    end
  49.    else
  50.       exit
  51. end
  52.  
  53. /*** build drawing area ***/
  54.  
  55. x=30
  56. y=150
  57. i=x+650
  58. k=y+70
  59.  
  60. 'DrawColor 0'
  61. 'DrawRectFill' x y i k
  62. 'DrawColor 1'
  63. if ger then
  64.    'DrawText 300, 162, "Erledigt:"'
  65. else
  66.    'DrawText 300, 162, "Progress:"'
  67.  
  68. 'DrawText 150, 195, "0%"'
  69. 'DrawText 520, 195, "100%"'
  70. call DrawShadow
  71.  
  72. x=150
  73. y=170
  74. i=560
  75. k=y+15
  76.  
  77.  
  78. /*** ...and off we go ***/
  79.  
  80. if (right(target, 1) ~= ':') then
  81.    path = path || '/'
  82. target=target || '/M&M'
  83.  
  84. if ger then
  85.    Call StatusOut ("'Zielverzeichnis " || target || " erstellen...'")
  86. else
  87.    Call StatusOut ("'Creating target directory " || target || "...'")
  88. ADDRESS COMMAND Makedir "> nil:" target
  89. ADDRESS COMMAND "Copy Examples.info to "||target||".info QUIET"
  90. Call Complete (5)
  91.  
  92.  
  93. /*** copy files ***/
  94.  
  95. copyDone=0
  96. Call CopyFile('MMEditor')
  97. if ~copyDone then
  98.    exit
  99. Call CopyFile('MMEditor.info')
  100. if copyDone then
  101.    Call Complete (20)
  102. else
  103.    exit
  104.  
  105. Call CopyFile('MMPlayer')
  106. if ~copyDone then
  107.    exit
  108. Call CopyFile('MMPlayer.info')
  109. if copyDone then
  110.    Call Complete (30)
  111. else
  112.    exit
  113.  
  114. Call CopyFile('MMReq')
  115. if ~copyDone then
  116.    exit
  117. Call CopyFile('MMReq.info')
  118. if copyDone then
  119.    Call Complete (35)
  120. else
  121.    exit
  122.  
  123. Call CopyFile('MMAnalyse')
  124. if ~copyDone then
  125.    exit
  126. Call CopyFile('MMAnalyse.info')
  127. if copyDone then
  128.    Call Complete (40)
  129. else
  130.    exit
  131.  
  132. Call CopyFile('Examples')
  133. if ~copyDone then
  134.    exit
  135. Call CopyFile('Examples.info')
  136. if copyDone then
  137.    Call Complete (60)
  138. else
  139.    exit            
  140.  
  141. Call CopyFile('M&M.config.info')
  142. if ~copyDone then
  143.    exit
  144. Call CopyFile('M&M.icon.info')
  145. if copyDone then
  146.    Call Complete (65)
  147. else
  148.    exit
  149.  
  150. Call CopyFile('Install.M&M')
  151. if ~copyDone then
  152.    exit
  153. Call CopyFile('Install.bat')
  154. if ~copyDone then
  155.    exit 
  156. Call CopyFile('Install.rexx')
  157. if ~copyDone then
  158.    exit 
  159. Call CopyFile('Install.M&M.info')
  160. if copyDone then
  161.    Call Complete (70)
  162. else
  163.    exit
  164.  
  165. Call CopyFile('Registration.bat')
  166. if ~copyDone then
  167.    exit
  168. Call CopyFile('Registration.txt')
  169. if ~copyDone then
  170.    exit  
  171. Call CopyFile('Update.bat')
  172. if copyDone then
  173.    Call Complete (75)
  174. else
  175.    exit
  176.  
  177. Call CopyFile('M&M.guide')
  178. if ~copyDone then
  179.    exit
  180. Call CopyFile('M&M.guide.info')
  181. if copyDone then
  182.    Call Complete (85)
  183. else
  184.    exit           
  185.  
  186.  
  187. /*** Copying libraries ***/
  188. Call CopyLib ('ASL.library')
  189. Call Complete (87)
  190. Call CopyLib ('diskfont.library')
  191. Call Complete (90)
  192. Call CopyLib ('rexxsyslib.library')
  193. Call Complete (92)
  194. Call CopyLib ('AmigaGuide.library')
  195. Call Complete (94)
  196. Call CopyLib ('Locale.library')
  197. Call Complete (96)
  198.  
  199. /*** german catalogs ***/
  200. if ger then do
  201.     Call StatusOut ('"Deutschsprachige Kataloge kopieren..."')
  202.     'FileExists LOCALE:catalogs/deutsch'
  203.     if RESULT=0 then
  204.         'Req "Installation der deutsche Kataloge z.Zt. NICHT möglich!||||Bitte nachholen - sonst keine deutsche Oberfläche!" "Jawoll, wird erledigt!"'
  205.     else do
  206.         ADDRESS COMMAND "Copy MM:deutsch/MMEditor.catalog to LOCALE:Catalogs/deutsch QUIET"
  207.         ADDRESS COMMAND "Copy MM:deutsch/MMPlayer.catalog to LOCALE:Catalogs/deutsch QUIET"
  208.     end
  209. end
  210. Call Complete (98)
  211.  
  212.  
  213. /*** inserting MM: assign (used by examples) ***/
  214. if ger then
  215.     Call StatusOut ('"M&M Assign (insbes. für die Beispiele!) in S:User-Startup einfügen..."')
  216. else
  217.     Call StatusOut ('"Insert M&M Assign into S:User-Startup (important when trying the examples!)..."')
  218.  
  219. newtarget = '*"'||target||'/M&M*"'  
  220. ADDRESS COMMAND 'copy S:User-Startup to S:User-Startup.old'
  221. ADDRESS COMMAND 'echo >>S:User-Startup ";BEGIN Menus&More"'
  222. ADDRESS COMMAND 'echo >>S:User-Startup "ASSIGN MM: '||newtarget||'"'
  223. ADDRESS COMMAND 'echo >>S:User-Startup ";END Menus&More"'
  224.  
  225.  
  226. /*** done! ***/
  227. Call Complete (100)
  228. if ger then
  229.     'Req "Okay, die Installation wurde||erfolgreich beendet!" "Na super!"'
  230. else
  231.     'Req "Okay, Installation has been||finished successfully!" "Well done!"'
  232.  
  233.  
  234. Call StatusOut ('""')
  235. 'AlohaPlayer'
  236. exit
  237.  
  238.  
  239. /************ SubRoutines **************/
  240.  
  241.  
  242.  
  243. CopyFile:                               /* FileCopy routine */
  244.     parse arg file
  245.  
  246.     newtarget = target||"/"||file
  247.     if ger then
  248.        Call StatusOut ("'Kopiere "||file||" nach "||newtarget||"...'")
  249.     else
  250.        Call StatusOut ("'Copy "||file||" to "||newtarget||"...'")
  251.  
  252.     copyDone=1
  253.     do forever
  254.        ADDRESS COMMAND Copy ">NIL:" file newtarget "ALL QUIET"
  255.        if RC > 0 then do
  256.           if ger then
  257.              'Req "Kopieren ist fehlgeschlagen!" "Nochmal versuchen|Ignorieren|Abbrechen"'
  258.           else
  259.              'Req "Copy failed!" "Try again|Ignore|Cancel"'
  260.  
  261.           r=RESULT
  262.           if r=0 then do        /* cancel */
  263.              copyDone=0
  264.              leave
  265.           end
  266.           if r=2 then           /* ignore */
  267.              leave
  268.        end
  269.        else
  270.           leave
  271.     end
  272. return
  273.  
  274.  
  275. CopyLib:                                /* testing for existing libs */
  276.     parse arg lib
  277.  
  278.     if ger then
  279.         Call StatusOut ("'Teste "||lib||"...'")
  280.     else
  281.         Call StatusOut ("'Checking "||lib||"...'")
  282.  
  283.     'FileExists' 'LIBS:'||lib
  284.     if RESULT=0 then do
  285.         if ger then
  286.             "Req" "'Die Library||||"||lib||"||||existiert nicht! Bitte original Workbench-Disk||||in Laufwerk DF0: einlegen!'" "'Weiter|Ignorieren'"
  287.         else
  288.             "Req" "'The"||lib|| "||||does not exist!||||Please insert original Workbench-Disk into DF0:!'" "'Go on|Ignore'"
  289.  
  290.         do while (RESULT~=0)
  291.             if ger then
  292.                Call StatusOut ("'Kopiere DF0:Libs/"||lib||" nach LIBS: ...'")
  293.             else
  294.                Call StatusOut ("'Copy DF0:Libs/"||lib||" to LIBS: ...'")
  295.  
  296.             ADDRESS COMMAND "Copy DF0:Libs/"||lib||" to LIBS: QUIET"
  297.             if RC>0 then do
  298.                 if ger then
  299.                     "Req" "'Kopieren ist fehlgeschlagen!||||'" "'Nochmal versuchen|Ignorieren'"
  300.                 else
  301.                     "Req" "'Copy failed!||||'" "'Try again|Ignore'"
  302.             end
  303.         end
  304.     end
  305. return
  306.  
  307.  
  308. StatusOut:                              /* what is done currently */
  309.     procedure expose oldstatus
  310.     parse arg status
  311.     'DrawColor 0'
  312.     'DrawText 50, 210,' oldstatus
  313.     oldstatus = status
  314.     'DrawColor 6'
  315.     'DrawText 50, 210,' status
  316. return
  317.  
  318.  
  319. Complete:                               /* completage display */
  320.     parse arg percentage
  321.     'DrawColor 1'
  322.  
  323.     oldi = i; i = x + ((i-x)%100*percentage)
  324.  
  325.     'DrawRectFill' x y i k
  326.     call DrawShadow
  327.     i=oldi
  328. return
  329.  
  330.  
  331. DrawShadow:                             /* paint a shadow effect */
  332.     'DrawColor 2'                       /* white */
  333.     'DrawLine' x k x y
  334.     'DrawLine' x+1 k x+1 y+1
  335.     'DrawLine' x y i y
  336.  
  337.     'DrawColor 3'                       /* black */
  338.     'DrawLine' i y i k
  339.     'DrawLine' i-1 y+1 i-1 k
  340.     'DrawLine' i k x+1 k
  341. return
  342.  
  343.  
  344.  
  345.